//
//  PersonalHeaderVipCell.m
//  ChatForHot
//
//  Created by wr on 2018/10/22.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "PersonalHeaderVipCell.h"
#import "PersonalVipCellModel.h"

@interface PersonalHeaderVipCell ()

@property (nonatomic, strong) UIImageView *HOTCHATmarkIcon;
@property (nonatomic, strong) YYLabel *HOTCHATtitleLabel;
@property (nonatomic, strong) UIView *HOTCHATlineView;
@end

@implementation PersonalHeaderVipCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self HOTCHATinitSubViews];
    }
    return self;
}

- (void)HOTCHATinitSubViews {
    self.HOTCHATmarkIcon = [[UIImageView alloc] init];
    [self.contentView addSubview:self.HOTCHATmarkIcon];
    
    [self.HOTCHATtitleLabel setFont:[UIFont systemFontOfSize:16]];
    self.HOTCHATtitleLabel = [[YYLabel alloc] init];
    [self.HOTCHATtitleLabel setTextColor:[UIColor colorFromHexString:@"##222222"]];
    self.HOTCHATtitleLabel.backgroundColor = [UIColor clearColor];
    self.HOTCHATtitleLabel.textAlignment = NSTextAlignmentLeft;
    self.HOTCHATtitleLabel.numberOfLines = 0;
    [self.contentView addSubview:self.HOTCHATtitleLabel];
    
    self.HOTCHATlineView = [[UIView alloc] init];
    self.HOTCHATlineView.backgroundColor = HOTCHATrgb(230, 230, 230);
    [self.contentView addSubview:self.HOTCHATlineView];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.HOTCHATmarkIcon.size = CGSizeMake(34, 34);
    self.HOTCHATmarkIcon.centerY = self.contentView.centerY;
    self.HOTCHATmarkIcon.left = 15;
    
    self.HOTCHATtitleLabel.size = CGSizeMake(kScreenWidth - 60, 20);
    self.HOTCHATtitleLabel.left = self.HOTCHATmarkIcon.right + 10;
    self.HOTCHATtitleLabel.centerY = self.contentView.centerY;
    
    self.HOTCHATlineView.size = CGSizeMake(kScreenWidth - 59, PixelOne);
    self.HOTCHATlineView.left = self.HOTCHATtitleLabel.left;
    self.HOTCHATlineView.bottom = self.contentView.bottom;
}

- (void)HOTCHATbind:(PersonalVipCellModel *)model {
    _model = model;
    
    [self.HOTCHATmarkIcon setImage:[UIImage imageNamed:model.icon]];
    self.HOTCHATtitleLabel.text = self.model.title;
}
@end
